package com.siblings.loan.sys.data.http

import com.google.gson.Gson
import com.siblings.loan.sys.data.ASSycBuilder
import com.siblings.loan.sys.data.util.ASAesUtil

data class ASRequestParams(
    var path: String,
    var app: String = ASSycBuilder.appid,
    var token: String = ASSycBuilder.token,
    var product: String = ASSycBuilder.product,
    var androidId: String = ASSycBuilder.androidId,
    var advertId: String = ASSycBuilder.advertId,
    var type: String? = null,
    var client: String = "ANDROID",
    var appListGzip: String? = null,
    var smsRecordsGzip: String? = null,
    var smsFetchType: String? = null,
    var deviceHardwareGzip: String? = null,
    var deviceStorageGzip: String? = null,
    var deviceWifiGzip: String? = null,
    var deviceBatteryGzip: String? = null,
    var callLogListGzip: String? = null,
    var phoneBooksGzip: String? = null
) {

    fun toEncryptParams(): String {
        path = path.replace("/", "")
        if(path.isBlank()) return ""

        val content = Gson().toJson(this).trim()
        println("ASRequestParams aes before：\n$content")

        val result = ASAesUtil.encryptDefault(content)
        println("ASRequestParams aes after：\n$result")
        return result
    }
}
